package com.hotel.management.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.PostConstruct;

/**
 * 测试Controller
 * 用于验证Controller Bean创建是否正常
 */
@RestController
@RequestMapping("/test")
public class TestController {

    private static final Logger log = LoggerFactory.getLogger(TestController.class);

    public TestController() {
        log.info("TestController constructor called - Bean is being created");
    }

    @PostConstruct
    public void init() {
        log.info("TestController @PostConstruct called - Bean is ready");
    }

    @GetMapping("/hello")
    public String hello() {
        log.info("TestController.hello() called");
        return "Hello from TestController!";
    }
}
